package cn.class2.demo5.main

import cn.class2.demo5.{IEat, ISleep}

/**
  * Created by lzd on 2018/11/13.
  *
  * 不管是继承抽象类还是实现接口，第一个必须是extends ,之后的是with
  */
class Demo4 extends IEat with ISleep {
  override def sleep(): Unit = {
    println("demo3 class sleep")
  }

  /**
    * IEat 和ISleep中都有eat方法，如果不重写，会报错
    */
  override def eat(): Unit = {
    println("aaa")
  }
}

object Demo4 {
  def main(args: Array[String]): Unit = {
    val d = new Demo4
    d.sleep()
    d.eat()
  }
}
